using UnityEngine;

namespace EpicToonFX
{
    // [Assembly-CSharp.dll].EpicToonFX.ETFXTarget
    public class ETFXTarget : MonoBehaviour
    {
        
        #region EpicToonFX.ETFXTarget.<Respawn>d__7
        // [Assembly-CSharp.dll].EpicToonFX.ETFXTarget.<Respawn>d__7
        private sealed class _Respawn_d__7 : IEnumerator<object>, IEnumerator, IDisposable
        {
            // Fields
            private int __1__state;
            private object __2__current;
            public EpicToonFX.ETFXTarget __4__this;
            
            // Properties
            private object System.Collections.Generic.IEnumerator<System.Object>.Current { get; }
            private object System.Collections.IEnumerator.Current { get; }
            
            // Methods
            public _Respawn_d__7(int __1__state)
            {
                this.__1__state = __1__state;
            }
            private void System.IDisposable.Dispose()
            {
            
            }
            private bool MoveNext()
            {
                if(this.__1__state != 1)
                {
                        if(this.__1__state != 0)
                {
                        return false;
                }
                
                    this.__1__state = 0;
                    UnityEngine.WaitForSeconds val_1 = 536895821;
                    val_1 = new UnityEngine.WaitForSeconds(seconds:  3f);
                    this.__2__current = val_1;
                    this.__1__state = 1;
                    return false;
                }
                
                this.__1__state = 0;
                this.__4__this.SpawnTarget();
                return false;
            }
            private object System.Collections.Generic.IEnumerator<System.Object>.get_Current()
            {
                return (object)this.__2__current;
            }
            private void System.Collections.IEnumerator.Reset()
            {
                27351792 = new System.NotSupportedException();
                throw 27351792;
            }
            private object System.Collections.IEnumerator.get_Current()
            {
                return (object)this.__2__current;
            }
        
        }
        
        #endregion
        
        // Fields
        public UnityEngine.GameObject hitParticle;
        public UnityEngine.GameObject respawnParticle;
        private UnityEngine.Renderer targetRenderer;
        private UnityEngine.Collider targetCollider;
        
        // Methods
        private void Start()
        {
            this.targetRenderer = this.GetComponent<System.Object>();
            this.targetCollider = this.GetComponent<System.Object>();
        }
        private void SpawnTarget()
        {
            this.targetRenderer.enabled = true;
            this.targetCollider.enabled = true;
            UnityEngine.Vector3 val_2 = this.transform.position;
            UnityEngine.Quaternion val_4 = this.transform.rotation;
            UnityEngine.Object.Destroy(obj:  UnityEngine.Object.Instantiate<System.Object>(original:  this.respawnParticle, position:  new UnityEngine.Vector3() {x = val_2.x, y = val_2.y, z = val_2.z}, rotation:  new UnityEngine.Quaternion() {x = val_4.x, y = val_4.y, z = val_4.z, w = val_4.w}), t:  3.5f);
        }
        private void OnTriggerEnter(UnityEngine.Collider col)
        {
            UnityEngine.Collider val_11 = col;
            if((System.String.op_Equality(a:  val_11.tag, b:  -1610605377)) == false)
            {
                    return;
            }
            
            val_11 = this.hitParticle;
            if((UnityEngine.Object.op_Implicit(exists:  val_11)) == false)
            {
                    return;
            }
            
            UnityEngine.Vector3 val_5 = this.transform.position;
            UnityEngine.Quaternion val_7 = this.transform.rotation;
            UnityEngine.Object.Destroy(obj:  UnityEngine.Object.Instantiate<System.Object>(original:  this.hitParticle, position:  new UnityEngine.Vector3() {x = val_5.x, y = val_5.y, z = val_5.z}, rotation:  new UnityEngine.Quaternion() {x = val_7.x, y = val_7.y, z = val_7.z, w = val_7.w}), t:  2f);
            this.targetRenderer.enabled = false;
            this.targetCollider.enabled = false;
            UnityEngine.Coroutine val_10 = this.StartCoroutine(routine:  this.Respawn());
        }
        private System.Collections.IEnumerator Respawn()
        {
            object val_1 = 536898437;
            val_1 = new System.Object();
            mem[536898453] = 0;
            mem[536898469] = this;
            return (System.Collections.IEnumerator)val_1;
        }
        public ETFXTarget()
        {
        
        }
    
    }

}
